package com.lms.resource.service.exception;

import com.lms.common.web.annotation.enums.ResponseStatusEnum;
import lombok.Getter;
import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
import org.springframework.security.oauth2.core.OAuth2Error;

/**
 * 认证异常类
 *
 * @author wangtianrui
 */
@Getter
public class LmsOAuth2AuthenticationException extends OAuth2AuthenticationException {
    private final String code;

    public LmsOAuth2AuthenticationException(ResponseStatusEnum status) {
        super(new OAuth2Error(status.getMessage()), status.getMessage());
        this.code = status.getCode();
    }

    public LmsOAuth2AuthenticationException(ResponseStatusEnum status, String msg) {
        super(new OAuth2Error(status.getMessage()), msg);
        this.code = status.getCode();
    }
}